package com.dingwen.minsta.service.impl;

import com.dingwen.minsta.service.ClientService;
import io.minio.MinioClient;
import io.minio.errors.InvalidEndpointException;
import io.minio.errors.InvalidPortException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * client service impl
 *
 * @author dingwen
 * 2021.05.25 17:35
 */
@Service
public class ClientServiceImpl implements ClientService {
    @Override
    public MinioClient getClient(String endpoint, String accessKey, String secretKey) {
        try {
            return new MinioClient(endpoint, accessKey, secretKey);
        } catch (InvalidEndpointException | InvalidPortException e) {
            e.printStackTrace();
        }
        return null;
    }

}
